package com.guang.test.config;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.beans.PropertyVetoException;

/**
 * @author liguang
 * @date 2022/8/24 10:06
 */
@Configuration
@ComponentScan("com.guang.test")
//@MapperScan("")
public class AppConfig {

//
//    @Bean
//    public DataSource dataSource() throws PropertyVetoException {
//        ComboPooledDataSource dataSource = new ComboPooledDataSource();
//        dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/ssm");
//        dataSource.setDriverClass("com.mysql.cj.jdbc.Driver");
//        dataSource.setUser("root");
//        dataSource.setPassword("root");
//        return dataSource;
//    }
//
//    /**
//     * 整合效果!这个需要单独来进行整合
//     * @return
//     * @throws Exception
//     */
//    @Bean
//    public SqlSessionFactory sqlSessionFactory() throws Exception {
//        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSource());
//        return sqlSessionFactoryBean.getObject();
//    }



}
